package dryven.sapi.jetty;

import java.io.File;

import dryven.NotImplementedException;
import dryven.config.ApplicationConfiguration;
import dryven.config.ConfigurationException;
import dryven.config.DatabaseConfiguration;
import dryven.config.MailSenderConfiguration;
import dryven.init.FrontControllerFactory;

public class JettyBaseConfiguration implements ApplicationConfiguration {
	private ApplicationConfiguration _appConfig;

	public JettyBaseConfiguration(ApplicationConfiguration appConfig) {
		_appConfig = appConfig;
	}

	public Iterable<String> getModelPackages() {
		return _appConfig.getModelPackages();
	}

	public String getApplicationRootPath() {
		return _appConfig.getApplicationRootPath();
	}

	public String getApplicationRootURLPath() {
		return "/";
	}

	public Iterable<String> getControllerPackages() {
		return _appConfig.getControllerPackages();
	}

	public String getCustomConfigValue(String... keys) {
		return _appConfig.getCustomConfigValue(keys);
	}

	public DatabaseConfiguration getDatabaseConfigurationByName(String connName)
			throws ConfigurationException {
		return _appConfig.getDatabaseConfigurationByName(connName);
	}

	public Iterable<DatabaseConfiguration> getDatabaseConfigurations() {
		return _appConfig.getDatabaseConfigurations();
	}

	public DebugEnvironment getDebugEnvironment() {
		return DebugEnvironment.Development;
	}

	public DatabaseConfiguration getDefaultDatabaseConfiguration() {
		return _appConfig.getDefaultDatabaseConfiguration();
	}

	public Class<? extends FrontControllerFactory> getFrontControllerFactoryClass() {
		return _appConfig.getFrontControllerFactoryClass();
	}

	public MailSenderConfiguration getMailSenderConfiguration() {
		return _appConfig.getMailSenderConfiguration();
	}

	public String getServerName() {
		return "localhost";
	}

	public String getSignSecret() {
		return _appConfig.getSignSecret();
	}

	public File getUserDataDirectory() {
		return _appConfig.getUserDataDirectory();
	}

	@Override
	public Iterable<String> getViewPackages() {
		return _appConfig.getViewPackages();
	}

	@Override
	public Iterable<String> getClassPathEntries() {
		throw new NotImplementedException();
	}
}
